package com.netsdk.demo.util.sql;

import com.netsdk.lib.NetSDKLib;
import com.netsdk.lib.enumeration.NET_EM_OVER_FLOW_STATE;

public class TrafficFlowStateDto {

    private int nChannelID;
    private String szName;
    private int nEventId;
    private int nLane;
    private int dwState;
    private int dwFlow;
    private double fAverageSpeed;
    private int emDrivingDir;
    private String utc;


    public static TrafficFlowStateDto init(NetSDKLib.DEV_EVENT_TRAFFIC_FLOW_STATE msg) {
        TrafficFlowStateDto trafficFlowStateDto = new TrafficFlowStateDto();
        trafficFlowStateDto.setnChannelID(msg.nChannelID);
        trafficFlowStateDto.setUtc(msg.UTC.toString2());
        trafficFlowStateDto.setnEventId(msg.nEventID);
        if (msg.nStateNum != 1) {
            throw new RuntimeException("异常状态");
        }
        for (int i = 0; i < msg.nStateNum; i++) {
            NetSDKLib.NET_TRAFFIC_FLOW_STATE stuState = msg.stuStates[i];
            trafficFlowStateDto.setnLane(stuState.nLane);
            trafficFlowStateDto.setDwState(stuState.dwState);
            trafficFlowStateDto.setDwFlow(stuState.dwFlow);
            trafficFlowStateDto.setfAverageSpeed(stuState.fAverageSpeed);
            trafficFlowStateDto.setEmDrivingDir(stuState.stTrafficFlowDir.emDrivingDir);
        }
        return trafficFlowStateDto;
    }

    public String getUtc() {
        return utc;
    }

    public void setUtc(String utc) {
        this.utc = utc;
    }

    public int getnChannelID() {
        return nChannelID;
    }

    public void setnChannelID(int nChannelID) {
        this.nChannelID = nChannelID;
    }

    public String getSzName() {
        return szName;
    }

    public void setSzName(String szName) {
        this.szName = szName;
    }

    public int getnEventId() {
        return nEventId;
    }

    public void setnEventId(int nEventId) {
        this.nEventId = nEventId;
    }

    public int getnLane() {
        return nLane;
    }

    public void setnLane(int nLane) {
        this.nLane = nLane;
    }

    public int getDwState() {
        return dwState;
    }

    public void setDwState(int dwState) {
        this.dwState = dwState;
    }

    public int getDwFlow() {
        return dwFlow;
    }

    public void setDwFlow(int dwFlow) {
        this.dwFlow = dwFlow;
    }

    public double getfAverageSpeed() {
        return fAverageSpeed;
    }

    public void setfAverageSpeed(double fAverageSpeed) {
        this.fAverageSpeed = fAverageSpeed;
    }

    public int getEmDrivingDir() {
        return emDrivingDir;
    }

    public void setEmDrivingDir(int emDrivingDir) {
        this.emDrivingDir = emDrivingDir;
    }
}
